Calculator.tsx ➔ Calculator   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 14
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 14
rs 9.75
c 0
b 0
f 0
cc 1
1
import React, { useState } from "react";
2
3
export default function Calculator() {
4
  const [value, setValue] = useState("");
5
6
  return (
7
    <div>
8
      <input
9
        type="text"
10
        value={value}
11
        onChange={(e) => setValue(e.target.value)}
12
        placeholder="Enter calculation"
13
      />
14
      <button onClick={() => alert(eval(value))}>Calculate</button>
15
    </div>
16
  );
17
}